package com.nbsaas.boot.order.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.time.LocalDateTime;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "订单日志", model = "订单日志")
@Entity
@Table(name = "bs_order_log")
@Comment("订单操作日志表")
public class OrderLog extends AbstractEntity {

    @Comment("订单ID")
    @FormField(title = "订单ID", sortNum = "1", grid = true, required = true)
    @Column(name = "order_id", nullable = false)
    private Long orderId;

    @Comment("订单编号")
    @FormField(title = "订单编号", sortNum = "2", grid = true, required = true)
    @Column(name = "order_no", nullable = false, length = 64)
    private String orderNo;

    @Comment("操作人ID")
    @FormField(title = "操作人ID", sortNum = "3", grid = true, required = true)
    @Column(name = "operator_id", nullable = false)
    private Long operatorId;

    @Comment("操作人姓名")
    @FormField(title = "操作人姓名", sortNum = "4", grid = true, required = true)
    @Column(name = "operator_name", nullable = false, length = 50)
    private String operatorName;

    @Comment("操作人类型")
    @FormField(title = "操作人类型", sortNum = "5", grid = true, type = InputType.select)
    @Column(name = "operator_type", nullable = false)
    private Integer operatorType;

    @Comment("操作类型")
    @FormField(title = "操作类型", sortNum = "6", grid = true, required = true)
    @Column(name = "operation_type", nullable = false, length = 50)
    private String operationType;

    @Comment("操作描述")
    @FormField(title = "操作描述", sortNum = "7", grid = true, required = true)
    @Column(name = "operation_desc", nullable = false, length = 200)
    private String operationDesc;

    @Comment("操作时间")
    @FormField(title = "操作时间", sortNum = "8", type = InputType.date, grid = true, required = true)
    @Column(name = "operation_time", nullable = false)
    private LocalDateTime operationTime;

    @Comment("操作IP")
    @FormField(title = "操作IP", sortNum = "9", grid = true)
    @Column(name = "operation_ip", length = 50)
    private String operationIp;

    @Comment("操作数据")
    @FormField(title = "操作数据", sortNum = "10", type = InputType.textarea)
    @Column(name = "operation_data", columnDefinition = "text")
    private String operationData;
} 